package cn.study.luckyapp.server;

import cn.study.luckyapp.rule.command.RuleAddCmdExe;
import cn.study.luckyapp.rule.command.RuleUpdateCmdExe;
import cn.study.luckyapp.rule.query.RuleListByParamQueryExe;
import cn.study.luckyclient.api.IRuleService;
import cn.study.luckyclient.dto.RuleAddCmd;
import cn.study.luckyclient.dto.RuleUpdateCmd;
import cn.study.luckyclient.dto.data.RuleVo;
import cn.study.luckyclient.dto.query.RuleListByParamQuery;
import com.baomidou.mybatisplus.core.metadata.IPage;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Component;

@Component
@AllArgsConstructor
public class RuleServiceImpl implements IRuleService {
    private final RuleAddCmdExe ruleAddCmdExe;
    private final RuleUpdateCmdExe ruleUpdateCmdExe;
    private final RuleListByParamQueryExe ruleListByParamQueryExe;
    @Override
    public RuleVo add(RuleAddCmd cmd) {
        return ruleAddCmdExe.execute(cmd);
    }

    @Override
    public RuleVo update(RuleUpdateCmd cmd) {
        return ruleUpdateCmdExe.execute(cmd);
    }

    @Override
    public IPage<RuleVo> query(RuleListByParamQuery query) {
        return ruleListByParamQueryExe.execute(query);
    }
}
